package youth;

class Student {
    private String name;
    private String studentID;
    private String className;
    private String gender;
    private int age;
    private String personality;

    //构造函数
    public Student(String n,String id,String c,String g,int a,String p)
    {
        this.name = n;
        this.studentID = id;
        this.className = c;
        this.gender = g;
        this.age = a;
        this.personality = p;
    }
    //获取姓名
    public String getName(){
        return name;}

    //获取学号
    public String getStudentID(){
        return studentID;}

    //获取班级
    public String getClassName(){
        return className;}

    //获取性别
    public String getGender(){
        return gender;}

    //获取年龄
    public int getAge(){
        return age;}

    //获取性格
    public String getPersonality(){
        return personality;}

    //信息概要
    public String infoSummary(){
        return "姓名:"+name+",学号："+studentID+",班级： "+className+",性别："+gender+",年龄："+age+",性格："+personality;
    }
}
public class Ex1 {
    public static void main(String[] args) {
        //创建三个学生对象
        Student student1 = new Student("张三", "01", "地理科学", "男", 20, "开朗");
        Student student2 = new Student("李四", "02", "地理信息科学", "女", 18, "热情");
        Student student3 = new Student("王五", "05", "土地资源管理", "女", 19, "外向");
        //输出学生信息概要
        System.out.println(student1.infoSummary());
        System.out.println(student2.infoSummary());
        System.out.println(student3.infoSummary());
    }
}
